In software engineering, a connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required. Connection pools are used to enhance the performance of executing commands on a database. Opening and maintaining a database connection for each user, especially requests made to a dynamic database-driven website application, is costly and wastes resources. In connection pooling, after a connection is created, it is placed in the pool and it is used over again so that a new connection does not have to be established. If all the connections are being used, a new connection is made and is added to the pool. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the database.
Connection pooling being normally used in web-based and enterprise applications is usually handled by an application server. Any dynamic web page can be coded to open a connection and close it normally but behind the scenes when a new connection is requested, one is returned from the connection pool maintained by the application server. Similarly, when a connection is closed it is actually returned to the connection pool.
Connection pooling is not limited to using application servers. Traditional applications that need frequent access to databases can benefit from connection pooling as well. This was traditionally handled by manually maintaining database connections, but as expected, that meant very well-crafted programming as the framework for pooling is highly complex. In recent years, things have become a lot easier due to availability of third-party libraries that allow connection pooling as well as SQL statement pooling, thus giving high performance in database intensive applications.
Various parameters such as number of minimum connections, maximum connections and idle connections can be set to make sure the connection pool works well according to the environment it is deployed to work in.
Connection pooling is supported by IBM DB2[1], Microsoft SQL Server[2], Oracle.[3], MySQL[4] and PostgreSQL[5]